<script setup lang="ts">
/**子组件中通过 defineProps 接收父组件传递的属性 */
let prop = defineProps({
    fmoney:Number
});

/**子组件中通过 defineEmits 接收父组件传递的函数 */
let emit = defineEmits(['giveMoney'])
function changeMoney(){
    emit('giveMoney',30)
}

</script>
<template>
    <div class="son">
        <button class="defaultButton" @click="changeMoney">- 减少金额</button>
        <div class="info">我是子组件,金额：{{fmoney}} </div>
    </div>
</template>

<style scoped>
.son{
    width: 500px;
    background: #ede3e3;
    border-radius: 12px;
    padding:20px 20px 80px 20px;
    margin-top: 10px;
    border: 1px solid #c0c0c0;
    box-shadow: 3px 3px 10px #7c7b7b;
}
.info{
    padding: 50px 0 0;
    text-align: center;
}
</style>